package com.learn.springcloud.feigncodingconfigurationconsumer.controller;

import com.learn.springcloud.feigncodingconfigurationconsumer.bean.User;
import com.learn.springcloud.feigncodingconfigurationconsumer.service.FeignTestClient;
import com.learn.springcloud.feigncodingconfigurationconsumer.service.FeignTestClient2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Time : 2018/8/8 19:46
 * @Version : 1.0
 */
@RestController
public class FeignCodingConfigurationConsumer {

    @Autowired
    private FeignTestClient feignTestClient;

    @Autowired
    private FeignTestClient2 feignTestClient2;

    @RequestMapping(value = "/feign/coding/config/consumer/say/hello/{name}", method = RequestMethod.GET)
    public String sayHello(@PathVariable(name = "name") String name){
        System.out.println(name);
        return feignTestClient.sayHello1(name);
    }

    @RequestMapping(value = "/feign/coding/config/consumer/say/hello2", method = RequestMethod.POST)
    public User sayHello2(@RequestBody User user){
        return feignTestClient.sayHello2(user);
    }

    @RequestMapping(value = "/feign/coding/config/consumer/service/name/{name}", method = RequestMethod.GET)
    public String serviceName(@PathVariable(name = "name") String name){
        return feignTestClient2.get(name);
    }

}
